#pragma once

#include <gofcl_dma_ch_r.h>

typedef struct {
	u32_s CHEN : 1;
	u32_s FTFIE : 1;
	u32_s HTFIE : 1;
	u32_s ERRIE : 1;
	u32_s DIR : 1;
	u32_s CMEN : 1;
	u32_s PNAGA : 1;
	u32_s MNAGA : 1;
	u32_s PWIDTH : 2;
	u32_s MWIDTH : 2;
	u32_s PRIO : 2;
	u32_s M2M : 1;
	u32_s : 17;
} dma_chxctl_s;

_Static_assert(sizeof(dma_chxctl_s) == 4, "Struct dma_chxctl_s defined error!");

static inline void dma_wreg_chxctl_s(dma_qe dma_q, dma_ch_re channel_r,
				     dma_chxctl_s ctl) {
	union {
		dma_chxctl_s c;
		u32_s u;
	} cu = {
		.c = ctl,
	};
	dma_wreg_ch(dma_q, channel_r, DMA_CH_CTL_RR, cu.u);
}
